package com.test.java;

import java.util.Scanner;

/**
 * 本题要求计算A/B，其中A是不超过1000位的正整数，B是1位正整数。你需要输出商数Q和余数R，使得A = B * Q + R成立。
 * =============================================================
 * Version          Author          Date            Description
 * 1.0              白建         2017/12/18             创建
 * =============================================================
 */
public class Java_8
{

    private static String DIVIDEND;

    private static byte DIVISOR;

    public static void main(String[] args)
    {

        init();
        process();
    }

    private static void init()
    {

        Scanner scanner = new Scanner(System.in);
        String temp = scanner.nextLine();

        String[] strings = temp.split(" ");
        DIVIDEND = strings[0];
        DIVISOR = Byte.parseByte(strings[1]);
    }

    private static void process()
    {

        int result;
        int remainder = 0;
        for (int i = 0; i < DIVIDEND.length(); i++)
        {
            result = (remainder * 10 + Character.getNumericValue(DIVIDEND.charAt(i))) / DIVISOR;
            remainder = (remainder * 10 + Character.getNumericValue(DIVIDEND.charAt(i))) % DIVISOR;
            if (i == 0 && result == 0)
            {
                continue;
            }
            System.out.print(result);
        }
        System.out.print(" " + remainder);
    }
}
